package com.zygh.policeasset.mapper;

import com.zygh.policeasset.pojo.Menu;
import java.util.List;
import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Result;
import org.apache.ibatis.annotations.Results;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;

@Mapper
/* loaded from: police-asset-2.0-0.0.1-SNAPSHOT.jar:BOOT-INF/classes/com/zygh/policeasset/mapper/MenuMapper.class */
public interface MenuMapper {
    @Select({"<script> select * from menu <where> <if test='parentId != null '>parent_id=#{parentId}</if></where> </script>"})
    @Results({@Result(property = "parentId", column = "parent_id")})
    List<Menu> findMenuByParentId(Integer num);

    @Insert({"insert into menu (name,parent_id,path,icon,permission,type)values (#{name},#{parentId},#{path},#{icon},#{permission},#{type})"})
    Integer addMenu(Menu menu);

    @Delete({"delete from menu where id = #{id}"})
    Integer deleteMenu(int i);

    @Update({"<script>update menu <set> <if test='name != null and name.length &gt; 0'>name=#{name},</if><if test='parentId >= 0'>parent_id=#{parentId},</if><if test='path != null and path.length &gt; 0'>path=#{path},</if><if test='icon != null and icon.length &gt; 0'>icon=#{icon},</if><if test='permission != null and permission.length &gt; 0'>permission=#{permission},</if><if test='type != null '>type=#{type},</if></set> where id = #{id} </script>"})
    Integer updateMenu(Menu menu);

    @Select({"select * from menu where parent_id = #{parentId}"})
    List<Menu> findParent(int i);
}